/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package apartmentBean;

import bo.ApartmentContractBus;
import domain.pojo.Apartment;
import domain.pojo.ApartmentContract;
import domain.pojo.Client;
import java.sql.Date;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

/**
 *
 * @author lion
 */
@ManagedBean
@RequestScoped
public class ApartmentContractBean {

    /**
     * Creates a new instance of ApartmentContractBean
     */
    private ApartmentContract apartmentContract;
    private Apartment apartment;
    private Client client;
    
    public ApartmentContractBean() {
        apartmentContract = new ApartmentContract();
        apartmentContractBus = new ApartmentContractBus();
    }

    public Apartment getApartment() {
        return apartment;
    }

    public void setApartment(Apartment apartment) {
        this.apartment = apartment;
    }

    public Client getClient() {
        return client;
    }

    public void setClient(Client client) {
        this.client = client;
    }
    private ApartmentContractBus apartmentContractBus;

    public ApartmentContract getApartmentContract() {
        return apartmentContract;
    }

    public void setApartmentContract(ApartmentContract apartmentContract) {
        this.apartmentContract = apartmentContract;
    }

    public ApartmentContractBus getApartmentContractBus() {
        return apartmentContractBus;
    }

    public void setApartmentContractBus(ApartmentContractBus apartmentContractBus) {
        this.apartmentContractBus = apartmentContractBus;
    }

    public Integer addApartmentContract() {
        apartmentContract.setCreator("duongpb");
        apartmentContract.setCreated(new Date(System.currentTimeMillis()));
        return apartmentContractBus.getApartmentContractDaoImpl().insertApartmentInteger(apartmentContract);
    }
}
